clear all
set more off
tempfile temp
set scheme plotplainblind

** DATA
use vote_onpe_dist, clear

merge 1:1 ubigeonac1993 using share_exposed2007
keep if _merge == 3
drop _merge


reg voted c.exposed##c.exposed [aw=N]
predict voted2, xb

reg voted c.exposed##c.exposed##c.exposed [aw=N]
predict voted3, xb

gen lN = ln(N)

two (scatter voted exposed [aw=N], msymbol(Oh) mlwidth(thin) ytitle(Turnout (ONPE)) xtitle(% of voting pop. born in exposed districts)) ///
 (line voted2 exposed, sort lcolor(blue) lpattern(solid)) ///
 (line voted3 exposed, sort lcolor(green) lpattern(solid)) ///
 (lpoly voted exposed [aw=N], sort lcolor(red) lpattern(solid)) ///
 , legend(order(2 "Quadratic Fit" 3 "Cubic Fit" 4 "Polynomial Fit")) legend(pos(6)) legend(cols(3))

 graph export Figure_C1.png, replace height(1600) width(1800)
